Namespacing everything to /UVa.
[andmenj-acm.git] / UVa / 11371 - Number theory for newbies / intentando ayudar / delforo.cpp
blob7bfb33e5ae261af3bea36be4fdf9fe5c41922059
1 # include <iostream>
2 # include <algorithm>
3 # include <stdlib.h>
4 # include <string>
5 using namespace std;
8 long long int GetIntVal(string strConvert)
10 long long int intReturn;
12 intReturn = atoi(strConvert.c_str());
14 return(intReturn);
19 int main()
21 char num[11];
22 while(gets(num))
24 int size = strlen(num);
25 long long int ReversedNumber,Number,diff,divisor;
26 Number = GetIntVal(num);
27 sort(num,num+size);
28 reverse(num,num+size);
29 ReversedNumber = GetIntVal(num);
30 diff = ReversedNumber - Number;
31 divisor = diff / 9;
32 cout<<ReversedNumber<<" - "<<Number<<" = "<<diff<<" = 9 * "<<divisor<<endl;
35 return 0;